package com.hub.realtime.resource.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hub.realtime.common.utils.SqlCodeUtil;
import com.hub.realtime.framework.service.ServiceBase;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.hub.realtime.resource.mapper.ResFlinkConfMapper;
import com.hub.realtime.resource.domain.ResFlinkConf;
import com.hub.realtime.resource.service.IResFlinkConfService;

/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author wupeng
 * @date 2022-01-20
 */
@Service
public class ResFlinkConfServiceImpl extends ServiceBase<ResFlinkConfMapper, ResFlinkConf> implements IResFlinkConfService{
    @Override
    public ResFlinkConf getFlinkConfByJobId(Long jobId) {
        LambdaQueryWrapper<ResFlinkConf>lambdaQueryWrapper=new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(ResFlinkConf::getFlinkJobId,jobId);
        ResFlinkConf flinkConf = baseMapper.selectOne(lambdaQueryWrapper);
        if(StringUtils.isNotEmpty(flinkConf.getSqlText()))
        {
            flinkConf.setSqlText(SqlCodeUtil.base64Decode(flinkConf.getSqlText()));
        }
        return flinkConf;
    }
}
